﻿using com.iot.core.annotation; 
using com.iot.core.data;
using com.iot.core.data.entity; 
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace com.iot.ht.Controllers.htplat
{
    [ApiController]
    [Route("[controller]/[action]")]
    [Tag(Name = "平台", Description ="")]
    public class HtPlatController : ControllerBase
    {         
         
        IRepository<HtPlat> baseMapper;
        public HtPlatController(IRepository<HtPlat> p1)
        {    
            baseMapper=p1;
        }


        [HttpPost]
        [Operation(Summary= "平台列表", Description ="" )]
        [Auth(AuthType.Login)]
        [Log(LogNeed = false, LogPin = false, LogPout = false, LogTemplete = "")]
        public async Task<List<IdNameDto>> ListAsync( )
        {
            
            var q = baseMapper.GetAll();
            var r=await q.OrderBy(a => a.Id)
                .Select(a => new IdNameDto { Id = a.Id, Name = a.Name })
                .ToListAsync(); 
            return r;
        }
         
    }
}
